package hxs.events.flash.net;
import flash.net.Socket;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.events.SecurityErrorEvent;
import flash.events.DataEvent;
import flash.net.URLLoader;
import flash.net.URLStream;
import hxs.events.flash.events.EventDispatcherEvents;
import hxs.extras.FlashSignal;
import hxs.extras.FlashEventsStore;

/**
 * ...
 * @author Tony Polinelli
 */

class XMLSocketEvents extends EventDispatcherEvents
{

	public function new(target:URLStream) 
	{
		super(target);
	}
	
	public static function getEvents(target:URLStream):URLStreamEvents
	{
		return cast FlashEventsStore.getEvents(target);
	}
	
	/* */
	
	public var close(getClose, never):FlashSignal<Event>;
	private function getClose():FlashSignal<Event>
	{
		return cast getNativeSignal(Event.CLOSE);
	}
	
	public var connect(getConnect, never):FlashSignal<Event>;
	private function getConnect():FlashSignal<Event>
	{
		return cast getNativeSignal(Event.CONNECT);
	}

	public var data(getData, never):FlashSignal<DataEvent>;
	private function getData():FlashSignal<DataEvent>
	{
		return cast getNativeSignal(DataEvent.DATA);
	}

	public var ioError(getIoError, never):FlashSignal<IOErrorEvent>;
	private function getIoError():FlashSignal<IOErrorEvent>
	{
		return cast getNativeSignal(IOErrorEvent.IO_ERROR);
	}
	
	public var securityError(getSecurityError, never):FlashSignal<SecurityErrorEvent>;
	private function getSecurityError():FlashSignal<SecurityErrorEvent>
	{
		return cast getNativeSignal(SecurityErrorEvent.SECURITY_ERROR);
	}	
	
}